home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 8_12.lha / 8_12 / tst4.c < prev    next >
Text File  |  1993-08-08  |  670b  |  41 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <pat.h>
  6.  
  7. ain()
  8.  
  9.    pat p(cin);
  10.    int x;
  11.    float f;
  12.  
  13.    if (p.match("%f %d"))
  14. cout << "match %f %d succeeded\n";
  15.    else
  16. cout << "match %f %d failed\n";
  17.    p >> f;
  18.    cout << "f=" << f << "\n";
  19.    if (p.match("%d %f"))
  20. cout << "match %d %f succeeded\n";
  21.    else
  22. cout << "match %d %f failed\n";
  23.    p >> x;
  24.    cout << "x=" << x << "\n";
  25.    p >> f;
  26.    cout << "f=" << f << "\n";
  27.    p >> x;
  28.    cout << "x=" << x << "\n";
  29.  
  30.    char c[512];
  31.    for (;;)
  32. {
  33. p >> c;
  34. if (!p.good())
  35.     break;
  36. cout << c << "\n";
  37. }
  38.  
  39.    return 0;
  40.  
  41.